package btanalyzer.db.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

@Entity
@Table(name="DIGG_TASK")
public class DiggTask {
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq")
    @SequenceGenerator(name = "seq", sequenceName = "DIGG_TASK_SEQ")
    @Column(name="DIGG_TASK_ID")
	private Long id;
	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	@NotNull
	@Column(name="START_DATE")
	private Date startDate;
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	public Date getStartDate() {
		return startDate;
	}
	
	@Column(name="STOP_DATE")
	private Date stopDate;
	public void setStopDate(Date stopDate) {
		this.stopDate = stopDate;
	}
	public Date getStopDate() {
		return stopDate;
	}
	
	@OneToMany(mappedBy="diggTask", cascade=CascadeType.ALL)
	private Set<DiggedSite> diggedSites = new HashSet<DiggedSite>();
	public void setDiggedSites(Set<DiggedSite> diggedSites) {
		this.diggedSites = diggedSites;
	}
	public Set<DiggedSite> getDiggedSites() {
		return diggedSites;
	}

}
